from tkinter import *
from my_frame.login import AdminLoginPage
from my_frame.gnn import GnnFrame
from mini_tools.mytools import *
from updateExe import up000
import tkinter as tk

up000()
root = tk.Tk()
root.title('虾皮产品索引')
root.geometry("860x700")

utype=None
def cklogin():
    with open('config.json','r',encoding='utf-8') as f:
        cobj=json.load(f)
    if cobj.get('Uname') and cobj.get('Upwd'):
        rs=ms.ExecQuery('select utype from GTuser where uname=? and upwd=?',(cobj.get('Uname'),cobj.get('Upwd')))
        if len(rs)==0:
            return None
        else:
            return rs[0][0]
    else:
        return None

f0=GnnFrame(root)
lgp=AdminLoginPage(root,f0)

rbtnFra=Frame(f0,width=860)
rbtnFra.pack(pady=5)

utype=cklogin()

if utype:
    f0.cgpb(utype)
    f0.pack()
else:
    lgp.pack(expand=True, fill="both")

if __name__=='__main__':

    root.mainloop()